package bd;

import java.sql.Connection;

import oracle.jdbc.pool.OracleDataSource;

public class conexaoJDBC
{
	private static Connection myconnection = null;
	public conexaoJDBC()
	{
		
	}
	public static Connection getConnection()
	{
		if(myconnection == null)
		{
			try
			{
				Class.forName("oracle.jdbc.driver.OracleDriver").newInstance();
				String connString="jdbc:oracle:thin:@localhost:1521:XE";
				OracleDataSource ods = new OracleDataSource();
				ods.setURL(connString);
				ods.setUser("pucpr");
				ods.setPassword("pucpr");
				myconnection = ods.getConnection();
				System.out.println("Foi Connectado");
				
			}catch (Exception e) {
				
			}
		}
		return myconnection;
	}
}
